﻿#region File Description
/*-----------------------------------------------------------------------------
 Author: Jose Antonio Gallego
 Date: 24/10/2011
 
 License: Ms-PL
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.

 The example companies, organizations, products, domain names,
 e-mail addresses, logos, people, places, and events depicted
 herein are fictitious.  No association with any real company,
 organization, product, domain name, email address, logo, person,
 places, or events is intended or should be inferred.
-----------------------------------------------------------------------------*/
#endregion

using System;
using System.Device.Location;
using System.ComponentModel;
using GART.Data;

namespace Zombsquare.Models
{
    /// <summary>
    /// Representa el modelo de datos de un pushpin.
    /// </summary>
    public class PushpinModel : ARItem, INotifyPropertyChanged
    {
        public PushpinModel()
        {
            base.WorldCalculationMode = WorldCalculationMode.GeoRelativeToLocation;
        }

        /// <summary>
        /// Obtiene o establece la localización del pushpin.
        /// </summary>
        public GeoCoordinate Location 
        {
            get
            {
                return base.GeoLocation;
            }
            set
            {
                base.GeoLocation = value;
            } 
        }

        /// <summary>
        /// Obtiene o establece la ruta del icono del pushpin.
        /// </summary>
        public Uri Icon { get; set; }

        private int _tipo;
        public int Tipo 
        {
            get
            {
                return _tipo;
            }
            set
            {
                _tipo = value;
                switch (value)
                {
                    case 1:
                        Icon = new Uri("/Resources/Icons/Pushpins/PushpinZombie.png", UriKind.Relative);
                        TypeName = "PushpinZombie";
                        break;
                    default:
                        Icon = new Uri("/Resources/Icons/Pushpins/PushpinCivil.png", UriKind.Relative);
                        TypeName = "PushpinCivl";
                        break;
                }   
            }
        }

        /// <summary>
        /// Obtiene o establece el tipo de nombre del pushpin.
        /// </summary>
        public string TypeName { get; set; }

        public string Titulo 
        {
            get
            {
                return (string)base.Content;
            }
            set
            {
                base.Content = value;
            }
        
        }
        public string SubTitulo { get; set; }

        public PushpinModel data
        {
            get { return this; }
        }

        public PushpinModel Clone(GeoCoordinate location,string titulo, string subtitulo)
        {
            return new PushpinModel
            {
                Location = location,
                TypeName = TypeName,
                Icon = Icon,
                Titulo = titulo,
                SubTitulo = subtitulo
            };
        }

        public PushpinModel Clone(GeoCoordinate location)
        {
            return new PushpinModel
            {
                Location = location,
                TypeName = TypeName,
                Icon = Icon
            };
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
